package com.cjh.mybatis11.mapping;

import com.cjh.mybatis11.session.Configuration;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @Descripton 结果映射
 * @Author cjh
 * @Date 2023/6/30 10:47
 */
@NoArgsConstructor
@Getter
public class ResultMap {
    private String id;
    private Class<?> type;
    private List<ResultMapping> resultMappings;
    private Set<String> mappedColumns;

    public static class Builder{
        private ResultMap resultMap = new ResultMap();

        public Builder(Configuration configuration, String id, Class<?> type, List<ResultMapping> resultMappings) {
           resultMap.id = id;
           resultMap.type = type;
           resultMap.resultMappings = resultMappings;
        }

        public ResultMap build(){
            resultMap.mappedColumns = new HashSet<>();
            return resultMap;
        }
    }


}
